package cn.itcast.blog.web;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;

public class FormServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		System.out.println(req.getParameter("title"));
		System.out.println(req.getParameter("content"));
		System.out.println(req.getParameter("category"));

		// 响应
		Map<String, String> map = new HashMap<>();

		map.put("code", "0");
		map.put("message", "success");

		String string = JSON.toJSONString(map);

		resp.setContentType("application/json:charset=utf-8");
		resp.getWriter().write(string);

	}

}
